package com.paziy.notes.core.notations;

import com.paziy.notes.core.Clef;
import com.paziy.notes.core.sounds.Sound;

import java.util.Collection;
import java.util.LinkedList;

/**
 * The notation for some king of sound
 * @see com.paziy.notes.core.sounds.Sound
 *
 * @author thecederick@gmail.com (Paziy Evgeniy)
 * @version 0.2
 * @since 0.1 (09.12.13 16:26)
 */
public class Notation<S extends Sound> extends LinkedList<Bar<S>> {

    private Clef clef;

    public Notation(Clef clef) {
        super();
        this.clef = clef;
    }

    public Notation(Clef clef, Collection<Bar<S>> collection) {
        this(clef);
        addAll(collection);
    }

    /**
     * Returns notations clef.
     *
     * @return notations clef
     */
    public Clef getClef() {
        return clef;
    }

    /**
     * Adds an empty bar.
     *
     * @return created empty bar
     */
    public Bar<S> add() {
        Bar<S> bar = new Bar<S>();
        return add(bar) ? bar : null;
    }

}
